#include "brickManager.h"
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
BrickManager::BrickManager()
{
    count = 0;
    create();
}

void BrickManager::draw(Shader shader)
{
}
void BrickManager::create()
{
    int num_blocks = 5;
    float size_block = 0.5;
    float line_size = num_blocks * size_block;
    vector<int> plc;
    for (int i = 1; i <= num_blocks; i++)
        plc.push_back(i);
    random_shuffle(plc.begin(), plc.end());
    for (int i = 0; i < 3; i++)
    {
        float randx = -line_size / 2.0 - size_block / 2.0 + plc[i] * size_block;
        Brick *t = new Brick(randx, size_block, size_block, size_block);
    }
}
void BrickManager::update(float dt)
{
    count += dt;
    if (count > 3) //3秒产生新的砖块
    {
        count -= 3;
        create();
    }
}